from django.conf.urls.defaults import *

urlpatterns = patterns('',
    url(r'^$', 'ask.views.questions_by_cat', name='ask_index'),
    url(r'^order-by/(?P<order>publish|score|views|answers|unsolved)/$', 'ask.views.questions_by_cat', name='ask_index_ordered'),
    url(r'^(?P<action>asked|answered)-by/(?P<username>\w+)/$', 'ask.views.questions_of', name='ask_questions_of'),
    url(r'^(?P<action>asked|answered)-by/(?P<username>\w+)/(?P<order>publish|score|views|answers|unsolved)/$', 'ask.views.questions_of', name='ask_questions_of_ordered'),
    url(r'^ask/$', 'ask.views.create_question', name='ask_ask'),
    url(r'^accept/(?P<aid>\d+)/$', 'ask.views.accept_answer', name='ask_accept_answer'),
    url(r'^by-tag/(?P<tag>[^/]+)/$', 'ask.views.questions_by_cat', name='ask_questions_by_tag'),
    url(r'^by-tag/(?P<tag>[^/]+)/(?P<order>publish|score|views|answers|unsolved)/$', 'ask.views.questions_by_cat', name='ask_questions_by_tag_ordered'),
    url(r'^(?P<qid>\d+)/$', 'ask.views.question_detail', name='ask_question_detail'),
    url(r'^(?P<qid>\d+)/(?P<order>publish|score|rpublish)/$', 'ask.views.question_detail', name='ask_question_detail_ordered'),
    url(r'^(?P<qid>\d+)/edit/$', 'ask.views.create_question', name='ask_question_edit'),
    url(r'^(?P<qid>\d+)/delete/$', 'ask.views.delete_question', name='ask_question_delete'),
    url(r'^(?P<qid>\d+)/(?P<aid>\d+)/edit/$', 'ask.views.create_answer', name='ask_answer_edit'),
)
